import re

placeholder_pat = re.compile(r'\$\{(\w+)\}')

def generate_from_template(genfunc_table, template_file, output_file):
    for line in template_file:
        match = placeholder_pat.search(line)
        if match:
            genfunc_table[match.group(1)](output_file)
        else:
            output_file.write(line)
